// OPMLProcessor.h: interface for the OPMLProcessor class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_OPMLPROCESSOR_H__DBECA549_72AF_4B7F_A572_CC56D42CCC2B__INCLUDED_)
#define AFX_OPMLPROCESSOR_H__DBECA549_72AF_4B7F_A572_CC56D42CCC2B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "util.h"
#include "tinyxml/tinyxml.h"
#include "FeedTree.h"

class OPMLProcessor  
{
public:
	void SynFeedTree(CFeedTree* feedtree);
	string GetEncoding(){				
		return tolower(m_strEncoding);
	}

	// type of the CDOMTree method that will be called recursively for each node and all of its children
	typedef void (OPMLProcessor::*FOREACHITEM)(TiXmlNode*);
	enum
	{
		// call method on the parent node first, then on its children
		// otherwise, method is called on children first
		DOPARENTFIRST = 1<<0 ,
		// don't call a method on top most parent
		SKIPTOPPARENT = 1<<1
	};
	void DoForItemAndChildren( TiXmlNode* parent, FOREACHITEM fp, unsigned int flags = 0);

	bool ParseFile(const char* filename);
	bool Parse();
	OPMLProcessor();
	virtual ~OPMLProcessor();

protected:
	void Reset();
	void ShowNodeTitle(TiXmlNode* node);
private:
	string m_strEncoding;
	TiXmlDocument m_Xmldoc;
	TiXmlNode* m_pXmlBodyNode;
};

#endif // !defined(AFX_OPMLPROCESSOR_H__DBECA549_72AF_4B7F_A572_CC56D42CCC2B__INCLUDED_)
